﻿using UnityEngine;

namespace Script.EnemySystem.EnemyState
{
    public enum EnemyState
    {
        Idle = -2,
        Walk = -1,
        Hurt,
        Avoid,
        NormalAttack,
        ChaseAttack,
        JumpAttack,
        Defensing,
    }

    public class EnemyAnimTime
    {
        private float[] play;

        public EnemyAnimTime()
        {
            play = new float[10];
        }
        
        public float GetStateTime(EnemyState state)
        {
            if((int)state >= 0)
                return play[(int) state];
            return 0;
        }

        public void AddStateTime(EnemyState state, float time)
        {
            
            if (play.Length < (int) state)
            {
                float[] temp = play;
                play = new float[(int)state + 2];

                for (int i = 0; i < temp.Length; i++)
                {
                    play[i] = temp[i];
                }
                
            }

            play[(int)state] = time;
        }
        
    }
    
}